/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pruebas;

import java.sql.* ;
public class Aplicacion1 {
public static void main(String[] args) {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con =
DriverManager. getConnection("jdbc:mysql://localhost/tia1", "root", "");
Statement stmt = con.createStatement();
String idUsuario = "rcampoverde";
ResultSet rs = stmt.executeQuery("select * from usuario where id_usuario='"+ idUsuario +"'");
if(rs.next()) {
System.out.println("Nombres: " + rs.getString(3));
System.out.println("Paterno: " + rs.getString(4));
System.out.println("Correo: " + rs.getString(2));
}
rs.close();
stmt.close();
con.close();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
}

